home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / g_quake / motion.zip / CLIENT.QC < prev    next >
Text File  |  1996-08-11  |  34KB  |  1,457 lines

  1.  
  2. // prototypes
  3. void () W_WeaponFrame;
  4. void() W_SetCurrentAmmo;
  5. void() player_pain;
  6. void() player_stand1;
  7. void (vector org) spawn_tfog;
  8. void (vector org, entity death_owner) spawn_tdeath;
  9.  
  10. float   modelindex_eyes, modelindex_player;
  11.  
  12. /*
  13. =============================================================================
  14.  
  15.                 LEVEL CHANGING / INTERMISSION
  16.  
  17. =============================================================================
  18. */
  19.  
  20. float   intermission_running;
  21. float   intermission_exittime;
  22.  
  23. /*QUAKED info_intermission (1 0.5 0.5) (-16 -16 -16) (16 16 16)
  24. This is the camera point for the intermission.
  25. Use mangle instead of angle, so you can set pitch or roll as well as yaw.  'pitch roll yaw'
  26. */
  27. void() info_intermission =
  28. {
  29. };
  30.  
  31.  
  32.  
  33. void() SetChangeParms =
  34. {
  35. // remove items
  36.     self.items = self.items - (self.items & 
  37.     (IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD) );
  38.     
  39. // cap super health
  40.     if (self.health > 100)
  41.         self.health = 100;
  42.     if (self.health < 50)
  43.         self.health = 50;
  44.     parm1 = self.items;
  45.     parm2 = self.health;
  46.     parm3 = self.armorvalue;
  47.     if (self.ammo_shells < 25)
  48.         parm4 = 25;
  49.     else
  50.         parm4 = self.ammo_shells;
  51.     parm5 = self.ammo_nails;
  52.     parm6 = self.ammo_rockets;
  53.     parm7 = self.ammo_cells;
  54.     parm8 = self.weapon;
  55.     parm9 = self.armortype * 100;
  56. };
  57.  
  58. void() SetNewParms =
  59. {
  60.     parm1 = IT_SHOTGUN | IT_AXE;
  61.     parm2 = 100;
  62.     parm3 = 0;
  63.     parm4 = 25;
  64.     parm5 = 0;
  65.     parm6 = 0;
  66.     parm6 = 0;
  67.     parm8 = 1;
  68.     parm9 = 0;
  69. };
  70.  
  71. void() DecodeLevelParms =
  72. {
  73.     if (serverflags)
  74.     {
  75.         if (world.model == "maps/start.bsp")
  76.             SetNewParms ();     // take away all stuff on starting new episode
  77.     }
  78.     
  79.     self.items = parm1;
  80.     self.health = parm2;
  81.     self.armorvalue = parm3;
  82.     self.ammo_shells = parm4;
  83.     self.ammo_nails = parm5;
  84.     self.ammo_rockets = parm6;
  85.     self.ammo_cells = parm7;
  86.     self.weapon = parm8;
  87.     self.armortype = parm9 * 0.01;
  88. };
  89.  
  90. /*
  91. ============
  92. FindIntermission
  93.  
  94. Returns the entity to view from
  95. ============
  96. */
  97. entity() FindIntermission =
  98. {
  99.     local   entity spot;
  100.     local   float cyc;
  101.  
  102. // look for info_intermission first
  103.     spot = find (world, classname, "info_intermission");
  104.     if (spot)
  105.     {   // pick a random one
  106.         cyc = random() * 4;
  107.         while (cyc > 1)
  108.         {
  109.             spot = find (spot, classname, "info_intermission");
  110.             if (!spot)
  111.                 spot = find (spot, classname, "info_intermission");
  112.             cyc = cyc - 1;
  113.         }
  114.         return spot;
  115.     }
  116.  
  117. // then look for the start position
  118.     spot = find (world, classname, "info_player_start");
  119.     if (spot)
  120.         return spot;
  121.     
  122. // testinfo_player_start is only found in regioned levels
  123.     spot = find (world, classname, "testplayerstart");
  124.     if (spot)
  125.         return spot;
  126.     
  127.     objerror ("FindIntermission: no spot");
  128. };
  129.  
  130.  
  131. string nextmap;
  132. void() GotoNextMap =
  133. {
  134.     if (cvar("samelevel"))  // if samelevel is set, stay on same level
  135.         changelevel (mapname);
  136.     else
  137.         changelevel (nextmap);
  138. };
  139.  
  140.  
  141. void() ExitIntermission =
  142. {
  143. // skip any text in deathmatch
  144.     if (deathmatch)
  145.     {
  146.         GotoNextMap ();
  147.         return;
  148.     }
  149.     
  150.     intermission_exittime = time + 1;
  151.     intermission_running = intermission_running + 1;
  152.  
  153. //
  154. // run some text if at the end of an episode
  155. //
  156.     if (intermission_running == 2)
  157.     {
  158.         if (world.model == "maps/e1m7.bsp")
  159.         {
  160.             WriteByte (MSG_ALL, SVC_CDTRACK);
  161.             WriteByte (MSG_ALL, 2);
  162.             WriteByte (MSG_ALL, 3);
  163.             if (!cvar("registered"))
  164.             {
  165.                 WriteByte (MSG_ALL, SVC_FINALE);
  166.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task in the other three\nhaunted lands of Quake. Or are you? If\nyou don't register Quake, you'll never\nknow what awaits you in the Realm of\nBlack Magic, the Netherworld, and the\nElder World!");
  167.             }
  168.             else
  169.             {
  170.                 WriteByte (MSG_ALL, SVC_FINALE);
  171.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task. A Rune of magic\npower lies at the end of each haunted\nland of Quake. Go forth, seek the\ntotality of the four Runes!");
  172.             }
  173.             return;
  174.         }
  175.         else if (world.model == "maps/e2m6.bsp")
  176.         {
  177.             WriteByte (MSG_ALL, SVC_CDTRACK);
  178.             WriteByte (MSG_ALL, 2);
  179.             WriteByte (MSG_ALL, 3);
  180.  
  181.             WriteByte (MSG_ALL, SVC_FINALE);
  182.             WriteString (MSG_ALL, "The Rune of Black Magic throbs evilly in\nyour hand and whispers dark thoughts\ninto your brain. You learn the inmost\nlore of the Hell-Mother; Shub-Niggurath!\nYou now know that she is behind all the\nterrible plotting which has led to so\nmuch death and horror. But she is not\ninviolate! Armed with this Rune, you\nrealize that once all four Runes are\ncombined, the gate to Shub-Niggurath's\nPit will open, and you can face the\nWitch-Goddess herself in her frightful\notherworld cathedral.");
  183.             return;
  184.         }
  185.         else if (world.model == "maps/e3m6.bsp")
  186.         {
  187.             WriteByte (MSG_ALL, SVC_CDTRACK);
  188.             WriteByte (MSG_ALL, 2);
  189.             WriteByte (MSG_ALL, 3);
  190.  
  191.             WriteByte (MSG_ALL, SVC_FINALE);
  192.             WriteString (MSG_ALL, "The charred viscera of diabolic horrors\nbubble viscously as you seize the Rune\nof Hell Magic. Its heat scorches your\nhand, and its terrible secrets blight\nyour mind. Gathering the shreds of your\ncourage, you shake the devil's shackles\nfrom your soul, and become ever more\nhard and determined to destroy the\nhideous creatures whose mere existence\nthreatens the souls and psyches of all\nthe population of Earth.");
  193.             return;
  194.         }
  195.         else if (world.model == "maps/e4m7.bsp")
  196.         {
  197.             WriteByte (MSG_ALL, SVC_CDTRACK);
  198.             WriteByte (MSG_ALL, 2);
  199.             WriteByte (MSG_ALL, 3);
  200.  
  201.             WriteByte (MSG_ALL, SVC_FINALE);
  202.             WriteString (MSG_ALL, "Despite the awful might of the Elder\nWorld, you have achieved the Rune of\nElder Magic, capstone of all types of\narcane wisdom. Beyond good and evil,\nbeyond life and death, the Rune\npulsates, heavy with import. Patient and\npotent, the Elder Being Shub-Niggurath\nweaves her dire plans to clear off all\nlife from the Earth, and bring her own\nfoul offspring to our world! For all the\ndwellers in these nightmare dimensions\nare her descendants! Once all Runes of\nmagic power are united, the energy\nbehind them will blast open the Gateway\nto Shub-Niggurath, and you can travel\nthere to foil the Hell-Mother's plots\nin person.");
  203.             return;
  204.         }
  205.  
  206.         GotoNextMap();
  207.     }
  208.     
  209.     if (intermission_running == 3)
  210.     {
  211.         if (!cvar("registered"))
  212.         {   // shareware episode has been completed, go to sell screen
  213.             WriteByte (MSG_ALL, SVC_SELLSCREEN);
  214.             return;
  215.         }
  216.         
  217.         if ( (serverflags&15) == 15)
  218.         {
  219.             WriteByte (MSG_ALL, SVC_FINALE);
  220.             WriteString (MSG_ALL, "Now, you have all four Runes. You sense\ntremendous invisible forces moving to\nunseal ancient barriers. Shub-Niggurath\nhad hoped to use the Runes Herself to\nclear off the Earth, but now instead,\nyou will use them to enter her home and\nconfront her as an avatar of avenging\nEarth-life. If you defeat her, you will\nbe remembered forever as the savior of\nthe planet. If she conquers, it will be\nas if you had never been born.");
  221.             return;
  222.         }
  223.         
  224.     }
  225.  
  226.     GotoNextMap();
  227. };
  228.  
  229. /*
  230. ============
  231. IntermissionThink
  232.  
  233. When the player presses attack or jump, change to the next level
  234. ============
  235. */
  236. void() IntermissionThink =
  237. {
  238.     if (time < intermission_exittime)
  239.         return;
  240.  
  241.     if (!self.button0 && !self.button1 && !self.button2)
  242.         return;
  243.     
  244.     ExitIntermission ();
  245. };
  246.  
  247. void() execute_changelevel =
  248. {
  249.     local entity    pos;
  250.  
  251.     intermission_running = 1;
  252.     
  253. // enforce a wait time before allowing changelevel
  254.     if (deathmatch)
  255.         intermission_exittime = time + 5;
  256.     else
  257.         intermission_exittime = time + 2;
  258.  
  259.     WriteByte (MSG_ALL, SVC_CDTRACK);
  260.     WriteByte (MSG_ALL, 3);
  261.     WriteByte (MSG_ALL, 3);
  262.     
  263.     pos = FindIntermission ();
  264.  
  265.     other = find (world, classname, "player");
  266.     while (other != world)
  267.     {
  268.         other.view_ofs = '0 0 0';
  269.         other.angles = other.v_angle = pos.mangle;
  270.         other.fixangle = TRUE;      // turn this way immediately
  271.         other.nextthink = time + 0.5;
  272.         other.takedamage = DAMAGE_NO;
  273.         other.solid = SOLID_NOT;
  274.         other.movetype = MOVETYPE_NONE;
  275.         other.modelindex = 0;
  276.         setorigin (other, pos.origin);
  277.         other = find (other, classname, "player");
  278.     }   
  279.  
  280.     WriteByte (MSG_ALL, SVC_INTERMISSION);
  281. };
  282.  
  283.  
  284. void() changelevel_touch =
  285. {
  286.     local entity    pos;
  287.  
  288.     if (other.classname != "player")
  289.         return;
  290.  
  291.     if (cvar("noexit"))
  292.     {
  293.         T_Damage (other, self, self, 50000);
  294.         return;
  295.     }
  296.     bprint (other.netname);
  297.     bprint (" exited the level\n");
  298.     
  299.     nextmap = self.map;
  300.  
  301.     SUB_UseTargets ();
  302.  
  303.     if ( (self.spawnflags & 1) && (deathmatch == 0) )
  304.     {   // NO_INTERMISSION
  305.         GotoNextMap();
  306.         return;
  307.     }
  308.     
  309.     self.touch = SUB_Null;
  310.  
  311. // we can't move people right now, because touch functions are called
  312. // in the middle of C movement code, so set a think time to do it
  313.     self.think = execute_changelevel;
  314.     self.nextthink = time + 0.1;
  315. };
  316.  
  317. /*QUAKED trigger_changelevel (0.5 0.5 0.5) ? NO_INTERMISSION
  318. When the player touches this, he gets sent to the map listed in the "map" variable.  Unless the NO_INTERMISSION flag is set, the view will go to the info_intermission spot and display stats.
  319. */
  320. void() trigger_changelevel =
  321. {
  322.     if (!self.map)
  323.         objerror ("chagnelevel trigger doesn't have map");
  324.     
  325.     InitTrigger ();
  326.     self.touch = changelevel_touch;
  327. };
  328.  
  329.  
  330. /*
  331. =============================================================================
  332.  
  333.                 PLAYER GAME EDGE FUNCTIONS
  334.  
  335. =============================================================================
  336. */
  337.  
  338. void() set_suicide_frame;
  339.  
  340. // called by ClientKill and DeadThink
  341. void() respawn =
  342. {
  343.     if (coop)
  344.     {
  345.         // make a copy of the dead body for appearances sake
  346.         CopyToBodyQue (self);
  347.         // get the spawn parms as they were at level start
  348.         setspawnparms (self);
  349.         // respawn      
  350.         PutClientInServer ();
  351.     }
  352.     else if (deathmatch)
  353.     {
  354.         // make a copy of the dead body for appearances sake
  355.         CopyToBodyQue (self);
  356.         // set default spawn parms
  357.         SetNewParms ();
  358.         // respawn      
  359.         PutClientInServer ();
  360.     }
  361.     else
  362.     {   // restart the entire server
  363.         localcmd ("restart\n");
  364.     }
  365. };
  366.  
  367.  
  368. /*
  369. ============
  370. ClientKill
  371.  
  372. Player entered the suicide command
  373. ============
  374. */
  375. void() ClientKill =
  376. {
  377.     bprint (self.netname);
  378.     bprint (" suicides\n");
  379.     set_suicide_frame ();
  380.     self.modelindex = modelindex_player;
  381.     self.frags = self.frags - 2;    // extra penalty
  382.     respawn ();
  383. };
  384.  
  385. float(vector v) CheckSpawnPoint =
  386. {
  387.     return FALSE;
  388. };
  389.  
  390. /*
  391. ============
  392. SelectSpawnPoint
  393.  
  394. Returns the entity to spawn at
  395. ============
  396. */
  397. entity() SelectSpawnPoint =
  398. {
  399.     local   entity spot;
  400.     
  401. // testinfo_player_start is only found in regioned levels
  402.     spot = find (world, classname, "testplayerstart");
  403.     if (spot)
  404.         return spot;
  405.         
  406. // choose a info_player_deathmatch point
  407.     if (coop)
  408.     {
  409.         lastspawn = find(lastspawn, classname, "info_player_coop");
  410.         if (lastspawn == world)
  411.             lastspawn = find (lastspawn, classname, "info_player_start");
  412.         if (lastspawn != world)
  413.             return lastspawn;
  414.     }
  415.     else if (deathmatch)
  416.     {
  417.         lastspawn = find(lastspawn, classname, "info_player_deathmatch");
  418.         if (lastspawn == world)
  419.             lastspawn = find (lastspawn, classname, "info_player_deathmatch");
  420.         if (lastspawn != world)
  421.             return lastspawn;
  422.     }
  423.  
  424.     if (serverflags)
  425.     {   // return with a rune to start
  426.         spot = find (world, classname, "info_player_start2");
  427.         if (spot)
  428.             return spot;
  429.     }
  430.     
  431.     spot = find (world, classname, "info_player_start");
  432.     if (!spot)
  433.         error ("PutClientInServer: no info_player_start on level");
  434.     
  435.     return spot;
  436. };
  437.  
  438. /*
  439. ===========
  440. PutClientInServer
  441.  
  442. called each time a player is spawned
  443. ============
  444. */
  445. void() DecodeLevelParms;
  446. void() PlayerDie;
  447.  
  448.  
  449. void() PutClientInServer =
  450. {
  451.     local   entity spot;
  452.  
  453.     self.classname = "player";
  454.     self.health = 100;
  455.     self.takedamage = DAMAGE_AIM;
  456.     self.solid = SOLID_SLIDEBOX;
  457.     self.movetype = MOVETYPE_WALK;
  458.     self.show_hostile = 0;
  459.     self.max_health = 100;
  460.     self.flags = FL_CLIENT;
  461.     self.air_finished = time + 12;
  462.     self.dmg = 2;           // initial water damage
  463.     self.super_damage_finished = 0;
  464.     self.radsuit_finished = 0;
  465.     self.invisible_finished = 0;
  466.     self.invincible_finished = 0;
  467.     self.effects = 0;
  468.     self.invincible_time = 0;
  469.  
  470.     DecodeLevelParms ();
  471.     
  472.     W_SetCurrentAmmo ();
  473.  
  474.     self.attack_finished = time;
  475.     self.th_pain = player_pain;
  476.     self.th_die = PlayerDie;
  477.     
  478.     self.deadflag = DEAD_NO;
  479. // paustime is set by teleporters to keep the player from moving a while
  480.     self.pausetime = 0;
  481.     
  482.     spot = SelectSpawnPoint ();
  483.  
  484.     self.origin = spot.origin + '0 0 1';
  485.     self.angles = spot.angles;
  486.     self.fixangle = TRUE;       // turn this way immediately
  487.  
  488. // oh, this is a hack!
  489.     setmodel (self, "progs/eyes.mdl");
  490.     modelindex_eyes = self.modelindex;
  491.  
  492.     setmodel (self, "progs/player.mdl");
  493.     modelindex_player = self.modelindex;
  494.  
  495.     setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
  496.     
  497.     self.view_ofs = '0 0 22';
  498.  
  499.     player_stand1 ();
  500.     
  501.     if (deathmatch || coop)
  502.     {
  503.         makevectors(self.angles);
  504.         spawn_tfog (self.origin + v_forward*20);
  505.     }
  506.  
  507.     spawn_tdeath (self.origin, self);
  508. };
  509.  
  510.  
  511. /*
  512. =============================================================================
  513.  
  514.                 QUAKED FUNCTIONS
  515.  
  516. =============================================================================
  517. */
  518.  
  519.  
  520. /*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24)
  521. The normal starting point for a level.
  522. */
  523. void() info_player_start =
  524. {
  525. };
  526.  
  527.  
  528. /*QUAKED info_player_start2 (1 0 0) (-16 -16 -24) (16 16 24)
  529. Only used on start map for the return point from an episode.
  530. */
  531. void() info_player_start2 =
  532. {
  533. };
  534.  
  535.  
  536. /*
  537. saved out by quaked in region mode
  538. */
  539. void() testplayerstart =
  540. {
  541. };
  542.  
  543. /*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24)
  544. potential spawning position for deathmatch games
  545. */
  546. void() info_player_deathmatch =
  547. {
  548. };
  549.  
  550. /*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 24)
  551. potential spawning position for coop games
  552. */
  553. void() info_player_coop =
  554. {
  555. };
  556.  
  557. /*
  558. ===============================================================================
  559.  
  560. RULES
  561.  
  562. ===============================================================================
  563. */
  564.  
  565. void(entity c) PrintClientScore =
  566. {
  567.     if (c.frags > -10 && c.frags < 0)
  568.         bprint (" ");
  569.     else if (c.frags >= 0)
  570.     {
  571.         if (c.frags < 100)
  572.             bprint (" ");
  573.         if (c.frags < 10)
  574.             bprint (" ");
  575.     }
  576.     bprint (ftos(c.frags));
  577.     bprint (" ");
  578.     bprint (c.netname);
  579.     bprint ("\n");
  580. };
  581.  
  582. void() DumpScore =
  583. {
  584.     local entity    e, sort, walk;
  585.  
  586.     if (world.chain)
  587.         error ("DumpScore: world.chain is set");
  588.  
  589. // build a sorted lis
  590.     e = find(world, classname, "player");
  591.     sort = world;
  592.     while (e)
  593.     {
  594.         if (!sort)
  595.         {
  596.             sort = e;
  597.             e.chain = world;
  598.         }
  599.         else
  600.         {
  601.             if (e.frags > sort.frags)
  602.             {
  603.                 e.chain = sort;
  604.                 sort = e;
  605.             }
  606.             else
  607.             {
  608.                 walk = sort;
  609.                 do
  610.                 {
  611.                     if (!walk.chain)
  612.                     {
  613.                         e.chain = world;
  614.                         walk.chain = e;
  615.                     }
  616.                     else if (walk.chain.frags < e.frags)
  617.                     {
  618.                         e.chain = walk.chain;
  619.                         walk.chain = e;
  620.                     }
  621.                     else
  622.                         walk = walk.chain;
  623.                 } while (walk.chain != e);
  624.             }
  625.         }
  626.         
  627.         e = find(e, classname, "player");
  628.     }
  629.  
  630. // print the list
  631.     
  632.     bprint ("\n");  
  633.     while (sort)
  634.     {
  635.         PrintClientScore (sort);
  636.         sort = sort.chain;
  637.     }
  638.     bprint ("\n");
  639. };
  640.  
  641. /*
  642. go to the next level for deathmatch
  643. */
  644. void() NextLevel =
  645. {
  646.     local entity o;
  647.  
  648. // find a trigger changelevel
  649.     o = find(world, classname, "trigger_changelevel");
  650.     if (!o || mapname == "start")
  651.     {   // go back to same map if no trigger_changelevel
  652.         o = spawn();
  653.         o.map = mapname;
  654.     }
  655.  
  656.     nextmap = o.map;
  657.     
  658.     if (o.nextthink < time)
  659.     {
  660.         o.think = execute_changelevel;
  661.         o.nextthink = time + 0.1;
  662.     }
  663. };
  664.  
  665. /*
  666. ============
  667. CheckRules
  668.  
  669. Exit deathmatch games upon conditions
  670. ============
  671. */
  672. void() CheckRules =
  673. {
  674.     local   float       timelimit;
  675.     local   float       fraglimit;
  676.     
  677.     if (gameover)   // someone else quit the game already
  678.         return;
  679.         
  680.     timelimit = cvar("timelimit") * 60;
  681.     fraglimit = cvar("fraglimit");
  682.     
  683.     if (timelimit && time >= timelimit)
  684.     {
  685. NextLevel ();
  686. /*
  687.         gameover = TRUE;
  688.         bprint ("\n\n\n==============================\n");
  689.         bprint ("game exited after ");
  690.         bprint (ftos(timelimit/60));
  691.         bprint (" minutes\n");
  692.         DumpScore ();
  693.         localcmd ("killserver\n");
  694. */
  695.         return;
  696.     }
  697.     
  698.     if (fraglimit && self.frags >= fraglimit)
  699.     {
  700. NextLevel ();
  701. /*
  702.         gameover = TRUE;
  703.         bprint ("\n\n\n==============================\n");
  704.         bprint ("game exited after ");
  705.         bprint (ftos(self.frags));
  706.         bprint (" frags\n");
  707.         DumpScore ();
  708.         localcmd ("killserver\n");
  709. */
  710.         return;
  711.     }   
  712. };
  713.  
  714. //============================================================================
  715.  
  716. void() PlayerDeathThink =
  717. {
  718.     local entity    old_self;
  719.     local float     forward;
  720.  
  721.     if ((self.flags & FL_ONGROUND))
  722.     {
  723.         forward = vlen (self.velocity);
  724.         forward = forward - 20;
  725.         if (forward <= 0)
  726.             self.velocity = '0 0 0';
  727.         else    
  728.             self.velocity = forward * normalize(self.velocity);
  729.     }
  730.  
  731. // wait for all buttons released
  732.     if (self.deadflag == DEAD_DEAD)
  733.     {
  734.         if (self.button2 || self.button1 || self.button0)
  735.             return;
  736.         self.deadflag = DEAD_RESPAWNABLE;
  737.         return;
  738.     }
  739.  
  740. // wait for any button down
  741.     if (!self.button2 && !self.button1 && !self.button0)
  742.         return;
  743.  
  744.     self.button0 = 0;
  745.     self.button1 = 0;
  746.     self.button2 = 0;
  747.     respawn();
  748. };
  749.  
  750.  
  751. void() PlayerJump =
  752. {
  753.     local vector start, end;
  754.     
  755.     if (self.flags & FL_WATERJUMP)
  756.         return;
  757.     
  758.     if (self.waterlevel >= 2)
  759.     {
  760.         if (self.watertype == CONTENT_WATER)
  761.             self.velocity_z = 100;
  762.         else if (self.watertype == CONTENT_SLIME)
  763.             self.velocity_z = 80;
  764.         else
  765.             self.velocity_z = 50;
  766.  
  767. // play swiming sound
  768.         if (self.swim_flag < time)
  769.         {
  770.             self.swim_flag = time + 1;
  771.             if (random() < 0.5)
  772.                 sound (self, CHAN_BODY, "misc/water1.wav", 1, ATTN_NORM);
  773.             else
  774.                 sound (self, CHAN_BODY, "misc/water2.wav", 1, ATTN_NORM);
  775.         }
  776.  
  777.         return;
  778.     }
  779.  
  780.     if (!(self.flags & FL_ONGROUND))
  781.         return;
  782.  
  783.     if ( !(self.flags & FL_JUMPRELEASED) )
  784.         return;     // don't pogo stick
  785.  
  786.     self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  787.  
  788.     self.flags = self.flags - FL_ONGROUND;  // don't stairwalk
  789.     
  790.     self.button2 = 0;
  791. // player jumping sound
  792.     sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
  793.     self.velocity_z = self.velocity_z + 270;
  794. };
  795.  
  796.  
  797. /*
  798. ===========
  799. WaterMove
  800.  
  801. ============
  802. */
  803. .float  dmgtime;
  804.  
  805. void() WaterMove =
  806. {
  807. //dprint (ftos(self.waterlevel));
  808.     if (self.movetype == MOVETYPE_NOCLIP)
  809.         return;
  810.     if (self.health < 0)
  811.         return;
  812.  
  813.     if (self.waterlevel != 3)
  814.     {
  815.         if (self.air_finished < time)
  816.             sound (self, CHAN_VOICE, "player/gasp2.wav", 1, ATTN_NORM);
  817.         else if (self.air_finished < time + 9)
  818.             sound (self, CHAN_VOICE, "player/gasp1.wav", 1, ATTN_NORM);
  819.         self.air_finished = time + 12;
  820.         self.dmg = 2;
  821.     }
  822.     else if (self.air_finished < time)
  823.     {   // drown!
  824.         if (self.pain_finished < time)
  825.         {
  826.             self.dmg = self.dmg + 2;
  827.             if (self.dmg > 15)
  828.                 self.dmg = 10;
  829.             T_Damage (self, world, world, self.dmg);
  830.             self.pain_finished = time + 1;
  831.         }
  832.     }
  833.     
  834.     if (!self.waterlevel)
  835.     {
  836.         if (self.flags & FL_INWATER)
  837.         {   
  838.             // play leave water sound
  839.             sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
  840.             self.flags = self.flags - FL_INWATER;
  841.         }
  842.         return;
  843.     }
  844.  
  845.     if (self.watertype == CONTENT_LAVA)
  846.     {   // do damage
  847.         if (self.dmgtime < time)
  848.         {
  849.             if (self.radsuit_finished > time)
  850.                 self.dmgtime = time + 1;
  851.             else
  852.                 self.dmgtime = time + 0.2;
  853.  
  854.             T_Damage (self, world, world, 10*self.waterlevel);
  855.         }
  856.     }
  857.     else if (self.watertype == CONTENT_SLIME)
  858.     {   // do damage
  859.         if (self.dmgtime < time && self.radsuit_finished < time)
  860.         {
  861.             self.dmgtime = time + 1;
  862.             T_Damage (self, world, world, 4*self.waterlevel);
  863.         }
  864.     }
  865.     
  866.     if ( !(self.flags & FL_INWATER) )
  867.     {   
  868.  
  869. // player enter water sound
  870.  
  871.         if (self.watertype == CONTENT_LAVA)
  872.             sound (self, CHAN_BODY, "player/inlava.wav", 1, ATTN_NORM);
  873.         if (self.watertype == CONTENT_WATER)
  874.             sound (self, CHAN_BODY, "player/inh2o.wav", 1, ATTN_NORM);
  875.         if (self.watertype == CONTENT_SLIME)
  876.             sound (self, CHAN_BODY, "player/slimbrn2.wav", 1, ATTN_NORM);
  877.  
  878.         self.flags = self.flags + FL_INWATER;
  879.         self.dmgtime = 0;
  880.     }
  881.     
  882.     if (! (self.flags & FL_WATERJUMP) )
  883.         self.velocity = self.velocity - 0.8*self.waterlevel*frametime*self.velocity;
  884. };
  885.  
  886. void() CheckWaterJump =
  887. {
  888.     local vector start, end;
  889.  
  890. // check for a jump-out-of-water
  891.     makevectors (self.angles);
  892.     start = self.origin;
  893.     start_z = start_z + 8; 
  894.     v_forward_z = 0;
  895.     normalize(v_forward);
  896.     end = start + v_forward*24;
  897.     traceline (start, end, TRUE, self);
  898.     if (trace_fraction < 1)
  899.     {   // solid at waist
  900.         start_z = start_z + self.maxs_z - 8;
  901.         end = start + v_forward*24;
  902.         self.movedir = trace_plane_normal * -50;
  903.         traceline (start, end, TRUE, self);
  904.         if (trace_fraction == 1)
  905.         {   // open at eye level
  906.             self.flags = self.flags | FL_WATERJUMP;
  907.             self.velocity_z = 225;
  908.             self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  909.             self.teleport_time = time + 2;  // safety net
  910.             return;
  911.         }
  912.     }
  913. };
  914.  
  915.  
  916. /*
  917. ================
  918. PlayerPreThink
  919.  
  920. Called every frame before physics are run
  921. ================
  922. */
  923. void() PlayerPreThink =
  924. {
  925.     local   float   mspeed, aspeed;
  926.     local   float   r;
  927.  
  928.     if (intermission_running)
  929.     {
  930.         IntermissionThink ();   // otherwise a button could be missed between
  931.         return;                 // the think tics
  932.     }
  933.  
  934.     if (self.view_ofs == '0 0 0')
  935.         return;     // intermission or finale
  936.  
  937.     makevectors (self.v_angle);     // is this still used
  938.  
  939.     CheckRules ();
  940.     WaterMove ();
  941.  
  942.     if (self.waterlevel == 2)
  943.         CheckWaterJump ();
  944.  
  945.     if (self.deadflag >= DEAD_DEAD)
  946.     {
  947.         PlayerDeathThink ();
  948.         return;
  949.     }
  950.     
  951.     if (self.deadflag == DEAD_DYING)
  952.         return; // dying, so do nothing
  953.  
  954.     if (self.button2)
  955.     {
  956.         PlayerJump ();
  957.     }
  958.     else
  959.         self.flags = self.flags | FL_JUMPRELEASED;
  960.  
  961. // teleporters can force a non-moving pause time    
  962.     if (time < self.pausetime)
  963.         self.velocity = '0 0 0';
  964. };
  965.     
  966. /*
  967. ================
  968. CheckPowerups
  969.  
  970. Check for turning off powerups
  971. ================
  972. */
  973. void() CheckPowerups =
  974. {
  975.     if (self.health <= 0)
  976.         return;
  977.  
  978. // invisibility
  979.     if (self.invisible_finished)
  980.     {
  981. // sound and screen flash when items starts to run out
  982.         if (self.invisible_sound < time)
  983.         {
  984.             sound (self, CHAN_AUTO, "items/inv3.wav", 0.5, ATTN_IDLE);
  985.             self.invisible_sound = time + ((random() * 3) + 1);
  986.         }
  987.  
  988.  
  989.         if (self.invisible_finished < time + 3)
  990.         {
  991.             if (self.invisible_time == 1)
  992.             {
  993.                 sprint (self, "Ring of Shadows magic is fading\n");
  994.                 stuffcmd (self, "bf\n");
  995.                 sound (self, CHAN_AUTO, "items/inv2.wav", 1, ATTN_NORM);
  996.                 self.invisible_time = time + 1;
  997.             }
  998.             
  999.             if (self.invisible_time < time)
  1000.             {
  1001.                 self.invisible_time = time + 1;
  1002.                 stuffcmd (self, "bf\n");
  1003.             }
  1004.         }
  1005.  
  1006.         if (self.invisible_finished < time)
  1007.         {   // just stopped
  1008.             self.items = self.items - IT_INVISIBILITY;
  1009.             self.invisible_finished = 0;
  1010.             self.invisible_time = 0;
  1011.         }
  1012.         
  1013.     // use the eyes
  1014.         self.frame = 0;
  1015.         self.modelindex = modelindex_eyes;
  1016.     }
  1017.     else
  1018.         self.modelindex = modelindex_player;    // don't use eyes
  1019.  
  1020. // invincibility
  1021.     if (self.invincible_finished)
  1022.     {
  1023. // sound and screen flash when items starts to run out
  1024.         if (self.invincible_finished < time + 3)
  1025.         {
  1026.             if (self.invincible_time == 1)
  1027.             {
  1028.                 sprint (self, "Protection is almost burned out\n");
  1029.                 stuffcmd (self, "bf\n");
  1030.                 sound (self, CHAN_AUTO, "items/protect2.wav", 1, ATTN_NORM);
  1031.                 self.invincible_time = time + 1;
  1032.             }
  1033.             
  1034.             if (self.invincible_time < time)
  1035.             {
  1036.                 self.invincible_time = time + 1;
  1037.                 stuffcmd (self, "bf\n");
  1038.             }
  1039.         }
  1040.         
  1041.         if (self.invincible_finished < time)
  1042.         {   // just stopped
  1043.             self.items = self.items - IT_INVULNERABILITY;
  1044.             self.invincible_time = 0;
  1045.             self.invincible_finished = 0;
  1046.         }
  1047.         if (self.invincible_finished > time)
  1048.             self.effects = self.effects | EF_DIMLIGHT;
  1049.         else
  1050.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1051.     }
  1052.  
  1053. // super damage
  1054.     if (self.super_damage_finished)
  1055.     {
  1056.  
  1057. // sound and screen flash when items starts to run out
  1058.  
  1059.         if (self.super_damage_finished < time + 3)
  1060.         {
  1061.             if (self.super_time == 1)
  1062.             {
  1063.                 sprint (self, "Quad Damage is wearing off\n");
  1064.                 stuffcmd (self, "bf\n");
  1065.                 sound (self, CHAN_AUTO, "items/damage2.wav", 1, ATTN_NORM);
  1066.                 self.super_time = time + 1;
  1067.             }     
  1068.             
  1069.             if (self.super_time < time)
  1070.             {
  1071.                 self.super_time = time + 1;
  1072.                 stuffcmd (self, "bf\n");
  1073.             }
  1074.         }
  1075.  
  1076.         if (self.super_damage_finished < time)
  1077.         {   // just stopped
  1078.             self.items = self.items - IT_QUAD;
  1079.             self.super_damage_finished = 0;
  1080.             self.super_time = 0;
  1081.         }
  1082.         if (self.super_damage_finished > time)
  1083.             self.effects = self.effects | EF_DIMLIGHT;
  1084.         else
  1085.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1086.     }   
  1087.  
  1088. // suit 
  1089.     if (self.radsuit_finished)
  1090.     {
  1091.         self.air_finished = time + 12;      // don't drown
  1092.  
  1093. // sound and screen flash when items starts to run out
  1094.         if (self.radsuit_finished < time + 3)
  1095.         {
  1096.             if (self.rad_time == 1)
  1097.             {
  1098.                 sprint (self, "Air supply in Biosuit expiring\n");
  1099.                 stuffcmd (self, "bf\n");
  1100.                 sound (self, CHAN_AUTO, "items/suit2.wav", 1, ATTN_NORM);
  1101.                 self.rad_time = time + 1;
  1102.             }
  1103.             
  1104.             if (self.rad_time < time)
  1105.             {
  1106.                 self.rad_time = time + 1;
  1107.                 stuffcmd (self, "bf\n");
  1108.             }
  1109.         }
  1110.  
  1111.         if (self.radsuit_finished < time)
  1112.         {   // just stopped
  1113.             self.items = self.items - IT_SUIT;
  1114.             self.rad_time = 0;
  1115.             self.radsuit_finished = 0;
  1116.         }
  1117.     }   
  1118.  
  1119. };
  1120.  
  1121.  
  1122. /*
  1123. ================
  1124. PlayerPostThink
  1125.  
  1126. Called every frame after physics are run
  1127. ================
  1128. */
  1129. void() PlayerPostThink =
  1130. {
  1131.     local   float   mspeed, aspeed;
  1132.     local   float   r;
  1133.  
  1134.     if (self.view_ofs == '0 0 0')
  1135.         return;     // intermission or finale
  1136.     if (self.deadflag)
  1137.         return;
  1138.         
  1139. // do weapon stuff
  1140.  
  1141.     W_WeaponFrame ();
  1142.  
  1143. // check to see if player landed and play landing sound 
  1144.     if ((self.jump_flag < -300) && (self.flags & FL_ONGROUND) && (self.health > 0))
  1145.     {
  1146.         if (self.watertype == CONTENT_WATER)
  1147.             sound (self, CHAN_BODY, "player/h2ojump.wav", 1, ATTN_NORM);
  1148.         else if (self.jump_flag < -650)
  1149.         {
  1150.             T_Damage (self, world, world, 5); 
  1151.             sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
  1152.             self.deathtype = "falling";
  1153.         }
  1154.         else
  1155.             sound (self, CHAN_VOICE, "player/land.wav", 1, ATTN_NORM);
  1156.  
  1157.         self.jump_flag = 0;
  1158.     }
  1159.  
  1160.     if (!(self.flags & FL_ONGROUND))
  1161.         self.jump_flag = self.velocity_z;
  1162.  
  1163.     CheckPowerups ();
  1164. };
  1165.  
  1166.  
  1167. /*
  1168. ===========
  1169. ClientConnect
  1170.  
  1171. called when a player connects to a server
  1172. ============
  1173. */
  1174. void() ClientConnect =
  1175. {
  1176.     bprint (self.netname);
  1177.     bprint (" entered the game\n");
  1178.     
  1179. // a client connecting during an intermission can cause problems
  1180.     if (intermission_running)
  1181.         ExitIntermission ();
  1182. };
  1183.  
  1184.  
  1185. /*
  1186. ===========
  1187. ClientDisconnect
  1188.  
  1189. called when a player disconnects from a server
  1190. ============
  1191. */
  1192. void() ClientDisconnect =
  1193. {
  1194.     if (gameover)
  1195.         return;
  1196.     // if the level end trigger has been activated, just return
  1197.     // since they aren't *really* leaving
  1198.  
  1199.     // let everyone else know
  1200.     bprint (self.netname);
  1201.     bprint (" left the game with ");
  1202.     bprint (ftos(self.frags));
  1203.     bprint (" frags\n");
  1204.     sound (self, CHAN_BODY, "player/tornoff2.wav", 1, ATTN_NONE);
  1205.     set_suicide_frame ();
  1206. };
  1207.  
  1208. /*
  1209. ===========
  1210. ClientObituary
  1211.  
  1212. called when a player dies
  1213. ============
  1214. */
  1215. void(entity targ, entity attacker) ClientObituary =
  1216. {
  1217.     local   float rnum;
  1218.     local   string deathstring, deathstring2;
  1219.     rnum = random();
  1220.  
  1221.     if (targ.classname == "player")
  1222.     {
  1223.         if (attacker.classname == "teledeath")
  1224.         {
  1225.             bprint (targ.netname);
  1226.             bprint (" was telefragged by ");
  1227.             bprint (attacker.owner.netname);
  1228.             bprint ("\n");
  1229.  
  1230.             attacker.owner.frags = attacker.owner.frags + 1;
  1231.             return;
  1232.         }
  1233.  
  1234.         if (attacker.classname == "teledeath2")
  1235.         {
  1236.             bprint ("Satan's power deflects ");
  1237.             bprint (targ.netname);
  1238.             bprint ("'s telefrag\n");
  1239.  
  1240.             targ.frags = targ.frags - 1;
  1241.             return;
  1242.         }
  1243.  
  1244.         if (attacker.classname == "player")
  1245.         {
  1246.             if (targ == attacker)
  1247.             {
  1248.                 // killed self
  1249.                 attacker.frags = attacker.frags - 1;
  1250.                 bprint (targ.netname);
  1251.                 
  1252.                 if (targ.weapon == 64 && targ.waterlevel > 1)
  1253.                 {
  1254.                     bprint (" discharges into the water.\n");
  1255.                     return;
  1256.                 }
  1257.                 if (targ.weapon == 16)
  1258.                     bprint (" tries to put the pin back in\n");
  1259.                 else if (rnum)
  1260.                     bprint (" becomes bored with life\n");
  1261.                 else
  1262.                     bprint (" checks if his weapon is loaded\n");
  1263.                 return;
  1264.             }
  1265.             else
  1266.             {
  1267.                 attacker.frags = attacker.frags + 1;
  1268.  
  1269.                 rnum = attacker.weapon;
  1270.                 if (rnum == IT_AXE)
  1271.                 {
  1272.                     deathstring = " was ax-murdered by ";
  1273.                     deathstring2 = "\n";
  1274.                 }
  1275.                 if (rnum == IT_SHOTGUN)
  1276.                 {
  1277.                     deathstring = " chewed on ";
  1278.                     deathstring2 = "'s boomstick\n";
  1279.                 }
  1280.                 if (rnum == IT_SUPER_SHOTGUN)
  1281.                 {
  1282.                     deathstring = " ate 2 loads of ";
  1283.                     deathstring2 = "'s buckshot\n";
  1284.                 }
  1285.                 if (rnum == IT_NAILGUN)
  1286.                 {
  1287.                     deathstring = " was nailed by ";
  1288.                     deathstring2 = "\n";
  1289.                 }
  1290.                 if (rnum == IT_SUPER_NAILGUN)
  1291.                 {
  1292.                     deathstring = " was punctured by ";
  1293.                     deathstring2 = "\n";
  1294.                 }
  1295.                 if (rnum == IT_GRENADE_LAUNCHER)
  1296.                 {
  1297.                     deathstring = " eats ";
  1298.                     deathstring2 = "'s pineapple\n";
  1299.                     if (targ.health < -40)
  1300.                     {
  1301.                         deathstring = " was gibbed by ";
  1302.                         deathstring2 = "'s grenade\n";
  1303.                     }
  1304.                 }
  1305.                 if (rnum == IT_ROCKET_LAUNCHER)
  1306.                 {
  1307.                     deathstring = " rides ";
  1308.                     deathstring2 = "'s rocket\n";
  1309.                     if (targ.health < -40)
  1310.                     {
  1311.                         deathstring = " was gibbed by ";
  1312.                         deathstring2 = "'s rocket\n" ;
  1313.                     }
  1314.                 }
  1315.                 if (rnum == IT_LIGHTNING)
  1316.                 {
  1317.                     deathstring = " accepts ";
  1318.                     if (attacker.waterlevel > 1)
  1319.                         deathstring2 = "'s discharge\n";
  1320.                     else
  1321.                         deathstring2 = "'s shaft\n";
  1322.                 }
  1323.                 bprint (targ.netname);
  1324.                 bprint (deathstring);
  1325.                 bprint (attacker.netname);
  1326.                 bprint (deathstring2);
  1327.             }
  1328.             return;
  1329.         } else if (attacker.classname == "motion_detector")  {
  1330.             if (attacker.netname == "Healthy Detector")
  1331.             {
  1332.                 if (random() <= 0.333)
  1333.                 {
  1334.                     bprint ( targ.netname);
  1335.                     bprint (" was killed by a Motion Detector\n");
  1336.                 } else if(random() < 0.5) {
  1337.                     bprint ( targ.netname);
  1338.                     bprint (" was spiked by an inanimate object\n");
  1339.                 } else {
  1340.                     bprint ( targ.netname);
  1341.                     bprint (" was slain because he moved\n");
  1342.                 }
  1343.             } else {
  1344.                 bprint (targ.netname);
  1345.                 bprint (" was killed by an exploding Motion Detector\n");
  1346.             }
  1347.         }
  1348.         else
  1349.         {
  1350.             targ.frags = targ.frags - 1;        // killed self
  1351.             rnum = targ.watertype;
  1352.  
  1353.             bprint (targ.netname);
  1354.             if (rnum == -3)
  1355.             {
  1356.                 if (random() < 0.5)
  1357.                     bprint (" sleeps with the fishes\n");
  1358.                 else
  1359.                     bprint (" sucks it down\n");
  1360.                 return;
  1361.             }
  1362.             else if (rnum == -4)
  1363.             {
  1364.                 if (random() < 0.5)
  1365.                     bprint (" gulped a load of slime\n");
  1366.                 else
  1367.                     bprint (" can't exist on slime alone\n");
  1368.                 return;
  1369.             }
  1370.             else if (rnum == -5)
  1371.             {
  1372.                 if (targ.health < -15)
  1373.                 {
  1374.                     bprint (" burst into flames\n");
  1375.                     return;
  1376.                 }
  1377.                 if (random() < 0.5)
  1378.                     bprint (" turned into hot slag\n");
  1379.                 else
  1380.                     bprint (" visits the Volcano God\n");
  1381.                 return;
  1382.             }
  1383.  
  1384.             if (attacker.flags & FL_MONSTER)
  1385.             {
  1386.                 if (attacker.classname == "monster_army")
  1387.                     bprint (" was shot by a Grunt\n");
  1388.                 if (attacker.classname == "monster_demon1")
  1389.                     bprint (" was eviscerated by a Fiend\n");
  1390.                 if (attacker.classname == "monster_dog")
  1391.                     bprint (" was mauled by a Rottweiler\n");
  1392.                 if (attacker.classname == "monster_dragon")
  1393.                     bprint (" was fried by a Dragon\n");
  1394.                 if (attacker.classname == "monster_enforcer")
  1395.                     bprint (" was blasted by an Enforcer\n");
  1396.                 if (attacker.classname == "monster_fish")
  1397.                     bprint (" was fed to the Rotfish\n");
  1398.                 if (attacker.classname == "monster_hell_knight")
  1399.                     bprint (" was slain by a Death Knight\n");
  1400.                 if (attacker.classname == "monster_knight")
  1401.                     bprint (" was slashed by a Knight\n");
  1402.                 if (attacker.classname == "monster_ogre")
  1403.                     bprint (" was destroyed by an Ogre\n");
  1404.                 if (attacker.classname == "monster_oldone")
  1405.                     bprint (" became one with Shub-Niggurath\n");
  1406.                 if (attacker.classname == "monster_shalrath")
  1407.                     bprint (" was exploded by a Vore\n");
  1408.                 if (attacker.classname == "monster_shambler")
  1409.                     bprint (" was smashed by a Shambler\n");
  1410.                 if (attacker.classname == "monster_tarbaby")
  1411.                     bprint (" was slimed by a Spawn\n");
  1412.                 if (attacker.classname == "monster_vomit")
  1413.                     bprint (" was vomited on by a Vomitus\n");
  1414.                 if (attacker.classname == "monster_wizard")
  1415.                     bprint (" was scragged by a Scrag\n");
  1416.                 if (attacker.classname == "monster_zombie")
  1417.                     bprint (" joins the Zombies\n");
  1418.  
  1419.                 return;
  1420.             }
  1421.             if (attacker.classname == "explo_box")
  1422.             {
  1423.                 bprint (" blew up\n");
  1424.                 return;
  1425.             }
  1426.             if (attacker.solid == SOLID_BSP && attacker != world)
  1427.             {   
  1428.                 bprint (" was squished\n");
  1429.                 return;
  1430.             }
  1431.             if (targ.deathtype == "falling")
  1432.             {
  1433.                 targ.deathtype = "";
  1434.                 bprint (" fell to his death\n");
  1435.                 return;
  1436.             }
  1437.             if (attacker.classname == "trap_shooter" || attacker.classname == "trap_spikeshooter")
  1438.             {
  1439.                 bprint (" was spiked\n");
  1440.                 return;
  1441.             }
  1442.             if (attacker.classname == "fireball")
  1443.             {
  1444.                 bprint (" ate a lavaball\n");
  1445.                 return;
  1446.             }
  1447.             if (attacker.classname == "trigger_changelevel")
  1448.             {
  1449.                 bprint (" tried to leave\n");
  1450.                 return;
  1451.             }
  1452.  
  1453.             bprint (" died\n");
  1454.         }
  1455.     }
  1456. };
  1457.